<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@page import="crm.util.ParamUtil"%>
<%@page import="crm.model.Recepit"%>
<%@page import="crm.control.RecepitControl"%>
<%@page import="crm.control.EmployeesControl"%>
<%@page import="crm.util.GetBaseParam"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../../resources/css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../resources/css/inner.css" type="text/css" media="screen" />

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"">
<title>进行跟单移交页面</title>
   <script type="text/javascript" src="../../../resources/js/WebCalendar.js"></script>
   	<script type="text/javascript">
<!--
 function openwin(url,wwidth,wheight) 
 {
  var x=(screen.Width-wwidth)/2;
  var y=(screen.Height-wheight)/2;
  window.open(url, 'upload_photo', 'toolbars=0, scrollbars=0, location=0, statusbars=0, menubars=0, resizable=0, width='+wwidth+', height='+wheight+', left='+x+', top='+y);
 }
//-->
</script>
</head>
<body>
<%
             request.setCharacterEncoding("utf-8");
             int recepitId = ParamUtil.getInt(request,"id");
             Recepit re = RecepitControl.getRecepitById(recepitId);
             int transformedCount = RecepitControl.getTransferRecordNumber(recepitId);
             if(transformedCount==4){
            	 %>
            	 <script>
            	 alert("移交次数已达到上限，无法再次移交！")
            	 history.go(-1);
            	 </script>
            	 <%
             }else{
            	 %>
            	 <form action="transform_recepit_do.jsp?id=<%=recepitId %>" method="post">
            	 <table>
            	 <tr><td>当前跟单人</td><td><%=EmployeesControl.getEmployeesName(re.getCurrent_person()) %></td></tr>
            	 <tr><td>移交给</td><td><input type="text" name="" id="findemployee" onclick="openwin('select_employees.jsp?p=1',400,500)"><input type="hidden" name="person" id="employee" /></td></tr>
            	 <tr><td>移交阶段</td><td><%=GetBaseParam.getStageById(re.getStage()) %></td></tr>
            	 <%
            	   if(re.getStage()==5){  //若是后期跟进的阶段（回款），则需录入已回款数目
            	 %>
            	 <tr><td>在您进入跟单之前已共回款</td><td><%=RecepitControl.getTotalHuiKuanBefore(recepitId)%>元</td></tr>
            	 <tr><td>在您此次跟单期间回款金额共为</td><td><%=RecepitControl.getMyHuiKuan(recepitId) %>元</td></tr>
            	 <tr><td>当前跟单截止目前总共回款额为</td><td><%=RecepitControl.getTotalHuiKuan(recepitId) %>元</td></tr>
            	 <%
            	   System.out.print("WW"+(RecepitControl.getTransferRecordNumber(recepitId)-1)+"DDDD");
            	   }
            	 %>
            	<tr><td colspan='2'>
            	<input type="submit" class='button' value="确认移交">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            	<input type='button' class='button' value='返回' onclick='javascript:window.history.go(-1)'/>
            	</td></tr>
            	 </table>
            	 </form>
            	 <%
             }
%>

</body>
</html>